<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="b2DynamicTree,Box2D.Collision.b2DynamicTree,CreateProxy,DestroyProxy,GetFatAABB,GetUserData,MoveProxy,Query,RayCast,Rebalance" name="keywords">
<title>Box2D.Collision.b2DynamicTree</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'b2DynamicTree - Box2DFlash Documentation';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">Box2DFlash Documentation</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?Box2D/Collision/b2DynamicTree.html&amp;Box2D/Collision/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;b2DynamicTree</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class b2DynamicTree"); titleBar_setSubNav(false,false,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">Box2D.Collision</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class b2DynamicTree</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Source</td><td><a href="http://box2dflash.svn.sourceforge.net/viewvc/box2dflash/Source/Box2D/Collision/b2DynamicTree.as">b2DynamicTree.as</a></td>
</tr>
</table>
<p></p>
  A dynamic tree arranges data in a binary tree to accelerate
  queries such as volume queries and ray casts. Leafs are proxies
  with an AABB. In the tree we expand the proxy AABB by b2_fatAABBFactor
  so that the proxy AABB is bigger than the client object. This allows the client
  object to move by small amounts without triggering a tree update.
  
  Nodes are pooled.
  <p></p>
<br>
<hr>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#b2DynamicTree()">b2DynamicTree</a>()</div>
<div class="summaryTableDescription">
   Constructing the tree initializes the node pool.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#CreateProxy()">CreateProxy</a>(aabb:<a href="b2AABB.html">b2AABB</a>, userData:*):b2DynamicTreeNode</div>
<div class="summaryTableDescription">
   Create a proxy.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#DestroyProxy()">DestroyProxy</a>(proxy:b2DynamicTreeNode):void</div>
<div class="summaryTableDescription">
   Destroy a proxy.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#GetFatAABB()">GetFatAABB</a>(proxy:b2DynamicTreeNode):<a href="../Collision/b2AABB.html">b2AABB</a>
</div>
<div class="summaryTableDescription"></div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#GetUserData()">GetUserData</a>(proxy:b2DynamicTreeNode):*</div>
<div class="summaryTableDescription">
   Get user data from a proxy.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#MoveProxy()">MoveProxy</a>(proxy:b2DynamicTreeNode, aabb:<a href="b2AABB.html">b2AABB</a>, displacement:<a href="../Common/Math/b2Vec2.html">b2Vec2</a>):Boolean</div>
<div class="summaryTableDescription">
   Move a proxy with a swept AABB.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Query()">Query</a>(callback:Function, aabb:<a href="b2AABB.html">b2AABB</a>):void</div>
<div class="summaryTableDescription">
   Query an AABB for overlapping proxies.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#RayCast()">RayCast</a>(callback:Function, input:<a href="b2RayCastInput.html">b2RayCastInput</a>):void</div>
<div class="summaryTableDescription">
   Ray-cast against the proxies in the tree.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#Rebalance()">Rebalance</a>(iterations:int):void</div>
<div class="summaryTableDescription">
   Perform some iterations to re-balance the tree.</div>
</td><td class="summaryTableOwnerCol">b2DynamicTree</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="b2DynamicTree()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">b2DynamicTree</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function b2DynamicTree()</code><p>
   Constructing the tree initializes the node pool.
   </p></div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="CreateProxy()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">CreateProxy</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function CreateProxy(aabb:<a href="b2AABB.html">b2AABB</a>, userData:*):b2DynamicTreeNode</code><p>
   Create a proxy. Provide a tight fitting AABB and a userData.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">aabb</span>:<a href="b2AABB.html">b2AABB</a></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">userData</span>:*</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>b2DynamicTreeNode</code></td>
</tr>
</table>
</div>
<a name="DestroyProxy()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">DestroyProxy</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function DestroyProxy(proxy:b2DynamicTreeNode):void</code><p>
   Destroy a proxy. This asserts if the id is invalid.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">proxy</span>:b2DynamicTreeNode</code></td>
</tr>
</table>
</div>
<a name="GetFatAABB()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">GetFatAABB</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function GetFatAABB(proxy:b2DynamicTreeNode):<a href="../Collision/b2AABB.html">b2AABB</a></code><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">proxy</span>:b2DynamicTreeNode</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code><a href="../Collision/b2AABB.html">b2AABB</a></code></td>
</tr>
</table>
</div>
<a name="GetUserData()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">GetUserData</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function GetUserData(proxy:b2DynamicTreeNode):*</code><p>
   Get user data from a proxy. Returns null if the proxy is invalid.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">proxy</span>:b2DynamicTreeNode</code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>*</code></td>
</tr>
</table>
</div>
<a name="MoveProxy()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">MoveProxy</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function MoveProxy(proxy:b2DynamicTreeNode, aabb:<a href="b2AABB.html">b2AABB</a>, displacement:<a href="../Common/Math/b2Vec2.html">b2Vec2</a>):Boolean</code><p>
   Move a proxy with a swept AABB. If the proxy has moved outside of its fattened AABB,
   then the proxy is removed from the tree and re-inserted. Otherwise
   the function returns immediately.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">proxy</span>:b2DynamicTreeNode</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">aabb</span>:<a href="b2AABB.html">b2AABB</a></code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">displacement</span>:<a href="../Common/Math/b2Vec2.html">b2Vec2</a></code></td>
</tr>
</table>
<p></p>
<span class="label">Returns</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"></td><td><code>Boolean</code></td>
</tr>
</table>
</div>
<a name="Query()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Query</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function Query(callback:Function, aabb:<a href="b2AABB.html">b2AABB</a>):void</code><p>
   Query an AABB for overlapping proxies. The callback
   is called for each proxy that overlaps the supplied AABB.
   The callback should match function signature
   <code>fuction callback(proxy:b2DynamicTreeNode):Boolean</code>
   and should return false to trigger premature termination.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code></td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">aabb</span>:<a href="b2AABB.html">b2AABB</a></code></td>
</tr>
</table>
</div>
<a name="RayCast()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">RayCast</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function RayCast(callback:Function, input:<a href="b2RayCastInput.html">b2RayCastInput</a>):void</code><p>
   Ray-cast against the proxies in the tree. This relies on the callback
   to perform a exact ray-cast in the case were the proxy contains a shape.
   The callback also performs the any collision filtering. This has performance
   roughly equal to k log(n), where k is the number of collisions and n is the
   number of proxies in the tree.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">callback</span>:Function</code> &mdash; the ray-cast input data. The ray extends from p1 to p1 + maxFraction (p2 - p1).
   </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">input</span>:<a href="b2RayCastInput.html">b2RayCastInput</a></code> &mdash; a callback class that is called for each proxy that is hit by the ray.
   It should be of signature:
   <code>function callback(input:b2RayCastInput, proxy::void</code>
   </td>
</tr>
</table>
</div>
<a name="Rebalance()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">Rebalance</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function Rebalance(iterations:int):void</code><p>
   Perform some iterations to re-balance the tree.
   </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">iterations</span>:int</code></td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright">Box2DFlash 2.1a</center>
</div>
</body>
</html>
<!--Box2DFlash 2.1a-->
